package zhr.chapter10;

import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;

import java.io.InputStream;

public class Example10_7 {
    public static void main(String[] args) {
        Student mike=new Student("Mike",23,21);
        JSONObject json= (JSONObject) JSON.toJSON(mike);
        System.out.println(json);
        Student s1=JSON.parseObject(String.valueOf(json),Student.class);
        System.out.println(s1.getName());
        System.out.println(s1.getNum());
        System.out.println(s1.getAge());

    }
}
